﻿<?php
/**
 * The template for displaying Home page.
 *
 * @file      index.php
 * @package   autodaily news
 * @author    Chinh Tran
 * 
 **/
?>
<?php get_header();?>

<div class="content">
		<div class="wrapper">
			<div class="container">
				<div class="left-block feature-block full-width-md full-width-sm full-width-xs">
					<div class="feature-box full-width-xs">
						<div class="feature-news">
                        <?php $postID_exclude = array(); 
                                $args = array(
                                	'posts_per_page'      => 1,
                                    );
                            $the_query = new WP_Query($args);
                            // The Loop
                            if ( $the_query->have_posts() ) {
                            	
                            	while ( $the_query->have_posts() ) {
                            		$the_query->the_post();
                                    array_push($postID_exclude,get_the_ID()); 
                                    ?>
        							<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;"><img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?> "/></a>
        							<a href="<?php esc_url(the_permalink())?>" class="feature-tit" style="display: inline !important; height: 20px;"><h2> <?php the_title() ?> </h2></a>
        							<p><?php echo substr(get_the_excerpt(), 0,164); ?>..</p>
    						<?php }} wp_reset_postdata(); ?>
                        </div>
						<div class="trend-tag">
							<ul class="items-list">
                            <?php  
                                $args = array(
                                	'posts_per_page'      => 3,
                                    'post__not_in'        =>$postID_exclude,
                                    );
                                $the_query = new WP_Query($args);
                                // The Loop
                                if ( $the_query->have_posts() ) {
                                	
                                	while ( $the_query->have_posts() ) {
                                		$the_query->the_post();
                                        array_push($postID_exclude,get_the_ID()); 
                                        ?>
                                        	<li>
            									<div class="news-item" style="position: absolute;"> 
            										<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;" class="img"><img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?> "/></a>
            										<a href="<?php esc_url(the_permalink())?>"> <?php the_title() ?> </a>
            									</div>
            								</li>
            						
        						<?php }} wp_reset_postdata(); ?>
							</ul>
							<a href="http://www.enang.net"></a>
						</div><!--End trend tag-->
					</div><!--End feature tag-->
					
					<div class="news-list">
                        <div class="block-head hidden-lg hidden-md hidden-sm visible-xs">
							<h2>Mới cập nhật</h2>
							<div class="left-part"> 
								<div class="audai-line"> </div>
							</div>
						</div>
						<div class="clear"> </div>
						<ul>
							
                             <?php  $i==0;
                                    $args = array(
                                    	'posts_per_page'      => 8,
                                        'post__not_in'        =>$postID_exclude,
                                        );
                                    $the_query = new WP_Query($args);
                                    // The Loop
                                    if ( $the_query->have_posts() ) {
                                    	
                                    	while ( $the_query->have_posts() ) {
                                    		$the_query->the_post();
                                            array_push($postID_exclude,get_the_ID()); 
                                            if($i<=0){?>
                                                <li> 
                    								<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat;width: 100%; height: 92px; display: block; margin-bottom: 8px; background-size: cover;" class="img"><img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?> " style="display: none;"></a>
                    								<a href="<?php esc_url(the_permalink())?>"> <?php the_title() ?> </a> 
                    							</li>
                                            <?php }else {?>
                                            <li> <a href="<?php esc_url(the_permalink())?>"> <?php the_title() ?></a> </li>
                                            
            					<?php } $i++; } } wp_reset_postdata(); ?>
							
						</ul>
					</div>
				</div><!--End left-block-->
				<div class="right-block hidden-md hidden-sm hidden-xs">
					<div class="banner banner-300x250">
						<a href="#"> <img src="<?php echo get_template_directory_uri() ?>/images/banner_300x250.png" alt="logo"/></a>
					</div>
					<div class="banner banner-300x250">
						<a href="#"> <img src="<?php echo get_template_directory_uri() ?>/images/banner_300x250.png" alt="logo"/></a>
					</div>
				</div><!--End banner-block-->
			</div><!--End container-->
		</div><!--End feature-wrap-->
		<div class="clear"> </div>
        <div class="wrapper">
			<div class="container hidden-lg visible-md visible-sm" >
                <div class="block-head vde-blo-head" style="margin-top: 0 !important;">
					<div class="line-2"></div>
						<h1 class="two-word"> XEM TIẾP </h1>
					<div class="line-2"></div>
				</div>
                <ul class="large-items-list">
                    <?php  $args = array(
                               	'posts_per_page'      => 6,
                                'meta_key'            => 'post_views_count',
                                'orderby'             =>  'meta_value_num',
                                'order'               => 'DESC', 
                            );
                            $the_query = new WP_Query($args);
                            // The Loop
                            if ( $the_query->have_posts() ) {
                                        	
                               	while ( $the_query->have_posts() ) {
                              		$the_query->the_post();
                                ?>
                                <li>
                    				<div class="news-item" style="position: absolute;"> 
                        				<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;" class="img"><img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?> "></a>
                        				<a href="<?php esc_url(the_permalink())?>"><?php the_title() ?> </a>
                        				
                    				</div>
                				</li>
                      <?php }} wp_reset_postdata(); ?>
                
                </ul>
            </div>
        </div>
        <div class="clear"> </div>
		<div class="wrapper">
			<div class="container hidden-md hidden-sm hidden-xs">
				<div class="mostview-block">
					<div class="mostview-bg"></div>
					<ul class="mostview-news-list slides">
                         <?php  
                                $args = array(
                                	'posts_per_page'      => 12,
                                    'meta_key'            => 'post_views_count',
                                    'orderby'             =>  'meta_value_num',
                                    'order'               => 'DESC', 
                                    );
                                $the_query = new WP_Query($args);
                                // The Loop
                                if ( $the_query->have_posts() ) {
                                	
                                	while ( $the_query->have_posts() ) {
                                		$the_query->the_post();
                                        ?>
                                        <li>
                							<div class="news-item"> 
                								<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;" class="img"><img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?> "/></a>
                								<a href="<?php esc_url(the_permalink())?>" style="padding: 0px 8px 0px 0px; display: block;"> <?php the_title() ?> </a>
                							  
                                            </div>
                						</li>
                                        
	                       <?php }} wp_reset_postdata(); ?>
					</ul>
				</div><!--End mostview-block-->
				<div class="clear"> </div>
				<div class="banner-bottom-block">
					<div class="banner banner-728x90">
						<a href="#"> <img src="<?php echo get_template_directory_uri() ?>/images/banner_728x90.png" id="mouse-banner" alt="banner_728x90"/></a>
					</div>
					<div class="banner banner-300x250">
						<a href="#"> <img src="<?php echo get_template_directory_uri() ?>/images/banner_300x250.png" class="hide-banner" alt="logo"/></a>
					</div>
				</div>
			</div><!--End container-->
		</div><!--End wrapper-->
		<div class="clear"> </div>
		<div class="wrapper">
			<div class="container">
				<div class="left-block full-width-md full-width-sm full-width-xs">
					<div class="block-row">
						<div class="block-head">
							<div class="line"></div>
							<h1> TIN SAO </h1>
							<div class="line"></div>
						</div>
						<div class="clear"> </div>
						<div class="block-1-2">
							<div class="block-1-2-left star-feature-bg full-width-xs">
                                <?php  $i = 0; $postID_exclude = array();
                                        $args = array(
                                            'category_name'      => 'sao',
                                        	'posts_per_page'      => 3
                                             
                                            );
                                        $the_query = new WP_Query($args);
                                        // The Loop
                                        if ( $the_query->have_posts() ) {
                                        	
                                        	while ( $the_query->have_posts() ) {
                                        		$the_query->the_post();
                                                array_push($postID_exclude,get_the_ID()); 
                                                
                                                if($i <= 0){ ?>
                                                <div class="feature-news">
                									<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;" ><img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?>"/></a>
                									<a href="<?php esc_url(the_permalink())?>" style="display: inline !important; "><h2> <?php the_title() ?> </h2></a>
                									<p><?php echo substr(get_the_excerpt(), 0,158); ?>..</p>
                								</div>
                                                
                                                <?php } else{?>
                                                <div class="news-item"> 
                									<a href="<?php esc_url(the_permalink())?>"> <?php the_title() ?> </a>
                								</div>
  					             <?php } $i++; }} wp_reset_postdata(); ?>
                                
							</div>
							<div class="block-1-2-right full-width-xs">
							
								<ul class="items-list full-width-xs">
                                    <?php  
                                            $args = array(
                                                'category_name'      => 'sao',
                                            	'posts_per_page'      => 6,
                                                'post__not_in'        =>$postID_exclude,
                                                );
                                            $the_query = new WP_Query($args);
                                            // The Loop
                                            if ( $the_query->have_posts() ) {
                                            	
                                            	while ( $the_query->have_posts() ) {
                                            		$the_query->the_post();?>
                                                        <li class="full-width-xs full-width-sm">
                    										<div class="news-item"> 
                    											<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;" class="img"><img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?> "/></a>
                    											<a href="<?php esc_url(the_permalink())?>"> <?php the_title() ?></a>
                                                                <span class="time hidden-lg hidden-md visible-sm visible-xs"> <?php echo get_the_date('H:s | d/m/Y'); ?></span>
                                                                 
                    										</div>
                    									</li>
                                                    
   					                <?php  }} wp_reset_postdata(); ?>
                                
								</ul>
								
							</div>
						</div>
					</div><!--End block-row-->
					<div class="clear"> </div>
					<div class="block-row">
						<div class="block-head">
							<div class="line-2"></div>
							<h1 class="two-word"> XÃ HỘI </h1>
							<div class="line-2"></div>
						</div>
						<div class="block-1-2 ">
							<div class="block-1-2-left health-feature-bg full-width-xs">
								
                                    <?php $i = 0; $postID_exclude = array();
                                            $args = array(
                                                'category_name'      => 'tin-hot',
                                            	'posts_per_page'      => 3
                                                 
                                                );
                                            $the_query = new WP_Query($args);
                                            // The Loop
                                            if ( $the_query->have_posts() ) {
                                            	
                                            	while ( $the_query->have_posts() ) {
                                            		$the_query->the_post();
                                                    array_push($postID_exclude,get_the_ID()); 
                                                    if($i <= 0){
                                                    ?>
                                                   <div class="feature-news"> 
                                                        <a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;" class="img"><img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?>"/></a>
                    									<a href="<?php esc_url(the_permalink())?>" style="display: inline;"><h2><?php the_title() ?> </h2></a>
                    									<p> <?php echo substr(get_the_excerpt(), 0,148); ?>..  </p>
                                                    </div>
                                                    <?php } else{ ?>
                                                    <div class="news-item"> 
                    									<a href="<?php esc_url(the_permalink())?>"> <?php the_title() ?> </a>
                    								</div>
                                     <?php  } $i++; }} wp_reset_postdata(); ?>
                                
							</div>
							<div class="block-1-2-right full-width-xs">
								<ul class="items-list">
                                    <?php $args = array(
                                            'category_name'      => 'tin-hot',
                                           	'posts_per_page'      => 6,
                                            'post__not_in'        =>$postID_exclude,
                                                         
                                        );
                                        $the_query = new WP_Query($args);
                                        // The Loop
                                        if ( $the_query->have_posts() ) {
                                            while ( $the_query->have_posts() ) {
                                                $the_query->the_post();
                                                array_push($postID_exclude,get_the_ID()); ?>
                                                
                                                <li class="full-width-sm">
            										<div class="news-item"> 
            											<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;" class="img"><img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?>"/></a>
            											<a href="<?php esc_url(the_permalink())?>"> <?php the_title() ?> </a>
                                                         <span class="time hidden-lg hidden-md visible-sm visible-xs"> <?php echo get_the_date('H:s | d/m/Y'); ?></span>
            										</div>
            									</li>
                                                             
                                    <?php  }} wp_reset_postdata(); ?>
                                
								</ul>
								
							</div>
						</div>
						<div class="clear"> </div>
						<div class="block-0-3 hidden-xs">
                            <?php $args = array(
                                            'category_name'      => 'tin-hot',
                                           	'posts_per_page'      => 2,
                                            'post__not_in'        =>$postID_exclude,
                                                         
                                        );
                                  $the_query = new WP_Query($args);
                                  // The Loop
                                  if ( $the_query->have_posts() ) {
                                    while ( $the_query->have_posts() ) {
                                        $the_query->the_post();
                                        array_push($postID_exclude,get_the_ID()); ?>
                                        <div class="column">
            								<a href="<?php esc_url(the_permalink())?>"><h2> <?php the_title() ?></h2></a>
            								<a href="<?php esc_url(the_permalink())?>" class="cover" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat;background-size: cover;"><img src="<?php echo get_bg_image(get_the_ID());?>" alt=""/></a>
            								<p> <?php echo substr(get_the_excerpt(), 0,148); ?>.. </p>
            							</div>
                                                             
                              <?php  }} wp_reset_postdata(); ?>
                        
							<div class="column">
								<ul class="relate fa-relate2">
                                    <?php $args = array(
                                                'category_name'      => 'tin-hot',
                                               	'posts_per_page'      => 6,
                                                'post__not_in'        =>$postID_exclude,
                                                             
                                            );
                                          $the_query = new WP_Query($args);
                                          // The Loop
                                          if ( $the_query->have_posts() ) {
                                            while ( $the_query->have_posts() ) {
                                                $the_query->the_post();
                                                array_push($postID_exclude,get_the_ID()); ?>
                                                <li><a href="<?php esc_url(the_permalink())?>"><?php the_title() ?></a></li>
                                                                     
                                      <?php  }} wp_reset_postdata(); ?>
                                  
								  </ul>
								
							</div>
						</div>
					</div><!--End block-row-->
					<a href="http://www.enang.net"></a>
					<div class="clear"> </div>
					<div class="block-row">
						<div class="block-head">
							<div class="line"></div>
							<h1> LÀM ĐẸP </h1>
							<div class="line"></div>
						</div>
						<div class="block-1-0">
							<div class="feature-landscape bea-cate full-width-xs">
                                <?php $postID_exclude = array();
                                        $args = array(
                                            'category_name'      => 'dep',
                                        	'posts_per_page'      => 1
                                             
                                            );
                                        $the_query = new WP_Query($args);
                                        // The Loop
                                        if ( $the_query->have_posts() ) {
                                        	
                                        	while ( $the_query->have_posts() ) {
                                        		$the_query->the_post();
                                                array_push($postID_exclude,get_the_ID()); ?>
                                                
                                                <a href="<?php esc_url(the_permalink())?>" class="cover beauty-height full-width-xs" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;"> <img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?> " /> </a>
        								        <a href="<?php esc_url(the_permalink())?>" style="display: inline !important; "><h2> <?php the_title() ?> </h2></a> 
                                                
                                   <?php  }} wp_reset_postdata(); ?>
                            
								<ul class="relate hidden-xs">
                                    <?php 
                                            $args = array(
                                                'category_name'      => 'dep',
                                            	'posts_per_page'      => 4,
                                                'post__not_in'        =>$postID_exclude,
                                                );
                                            $the_query = new WP_Query($args);
                                            // The Loop
                                            if ( $the_query->have_posts() ) {
                                            	
                                            	while ( $the_query->have_posts() ) {
                                            		$the_query->the_post();
                                                    array_push($postID_exclude,get_the_ID()); ?>
                                                    
                                                    <li><a href="<?php esc_url(the_permalink())?>"><?php the_title() ?></a></li> 
                                                    
                                     <?php  }} wp_reset_postdata(); ?>
                                
								</ul>
							</div>
							<div class="clear"> </div>
							<ul class="items-list">
                                 <?php $args = array(
                                                'category_name'      => 'dep',
                                            	'posts_per_page'      => 8,
                                                'post__not_in'        =>$postID_exclude,
                                                );
                                       $the_query = new WP_Query($args);
                                       // The Loop
                                        if ( $the_query->have_posts() ) {
                                            while ( $the_query->have_posts() ) {
                                            	$the_query->the_post();  ?>
                                                    
                                                    <li>
                    									<div class="news-item" style="position: absolute;"> 
                    										<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;" class="img"><img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?> "/></a>
                    										<a href="<?php esc_url(the_permalink())?>"> <?php the_title() ?> </a>
                                                            <span class="time re_ho_time hidden-lg hidden-md visible-sm visible-xs"> <?php echo get_the_date('H:s | d/m/Y'); ?></span>
                    									</div>
                    								</li>
                                                    
                                 <?php  }} wp_reset_postdata(); ?>
                            
								
							</ul>
						</div>
					</div><!--End block-row-->
					<div class="clear"> </div>
					<div class="block-row">
						<div class="block-head">
							<div class="line-2"></div>
							<h1 class="two-word"> GIA ĐÌNH</h1>
							<div class="line-2"></div>
						</div>
						<div class="block-1-0">
							<div class="block-1-0-top-box ">
								<div class="block-1-0-top-box-left">
									<div class="feature-landscape sm-fea-wid">
                                        <?php $postID_exclude = array();
                                            $args = array(
                                                'category_name'      => 'gia-dinh',
                                            	'posts_per_page'      => 1
                                                 
                                                );
                                            $the_query = new WP_Query($args);
                                            // The Loop
                                            if ( $the_query->have_posts() ) {
                                            	
                                            	while ( $the_query->have_posts() ) {
                                            		$the_query->the_post();
                                                    array_push($postID_exclude,get_the_ID()); ?>
                                                    <a href="<?php esc_url(the_permalink())?>" class="cover fa-height" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;"> 
            											<img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?> "/> 
            										</a>
            										<a href="<?php esc_url(the_permalink())?>" style="display: inline;"><h2> <?php the_title() ?></h2></a>
                                                    <div class="summary hidden-xs"> <?php echo substr(get_the_excerpt(), 0,148); ?>..  </div>
                                                    
                                          <?php  }} wp_reset_postdata(); ?>
                                    
										<ul class="relate hidden-xs">
                                            <?php $args = array(
                                                        'category_name'      => 'gia-dinh',
                                                    	'posts_per_page'      => 3,
                                                        'post__not_in'        =>$postID_exclude,
                                                         
                                                        );
                                                    $the_query = new WP_Query($args);
                                                    // The Loop
                                                    if ( $the_query->have_posts() ) {
                                                    	
                                                    	while ( $the_query->have_posts() ) {
                                                    		$the_query->the_post();
                                                            array_push($postID_exclude,get_the_ID()); ?>
                                                            <li><a href="<?php esc_url(the_permalink())?>"><?php the_title() ?></a></li>
                                                            
                                              <?php  }} wp_reset_postdata(); ?>
                                        
										</ul>
									</div>
								</div>
								<div class="block-1-0-top-box-right">
									<div class="feature-landscape hidden-xs">
                                        <?php $args = array(
                                                        'category_name'      => 'gia-dinh',
                                                    	'posts_per_page'      => 1,
                                                        'post__not_in'        =>$postID_exclude,
                                                         
                                                        );
                                                    $the_query = new WP_Query($args);
                                                    // The Loop
                                                    if ( $the_query->have_posts() ) {
                                                    	
                                                    	while ( $the_query->have_posts() ) {
                                                    		$the_query->the_post();
                                                            array_push($postID_exclude,get_the_ID()); ?>
                                                            <a href="<?php esc_url(the_permalink())?>" class="cover fa-feature2" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;"> 
                    											<img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?> " /> 
                    										</a>
                    										<a href="<?php esc_url(the_permalink())?>"><h2> <?php the_title() ?></h2></a>
                                                            
                                          <?php  }} wp_reset_postdata(); ?>
                                    
										
										<ul class="relate fa-relate2">
                                            <?php $args = array(
                                                        'category_name'      => 'gia-dinh',
                                                    	'posts_per_page'      => 4,
                                                        'post__not_in'        =>$postID_exclude,
                                                         
                                                        );
                                                    $the_query = new WP_Query($args);
                                                    // The Loop
                                                    if ( $the_query->have_posts() ) {
                                                    	
                                                    	while ( $the_query->have_posts() ) {
                                                    		$the_query->the_post();
                                                            array_push($postID_exclude,get_the_ID()); ?>
                                                            <li><a href="<?php esc_url(the_permalink())?>"><?php the_title() ?></a></li>
                                                            
                                             <?php  }} wp_reset_postdata(); ?>
										</ul>
									</div>
								</div>
							</div>
							<div class="clear"> </div>
							<ul class="items-list">
                                <?php $args = array(
                                            'category_name'      => 'gia-dinh',
                                           	'posts_per_page'      => 4,
                                            'post__not_in'        =>$postID_exclude,
                                                         
                                        );
                                        $the_query = new WP_Query($args);
                                        // The Loop
                                        if ( $the_query->have_posts() ) {
                                            while ( $the_query->have_posts() ) {
                                                $the_query->the_post();
                                                array_push($postID_exclude,get_the_ID()); ?>
                                                <li> 
                									<div class="news-item" style="position: absolute;"> 
                										<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;" class="img"><img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?> "/></a>
                										<a href="<?php esc_url(the_permalink())?>"> <?php the_title() ?> </a>
                                                        <span class="time re_ho_time hidden-lg hidden-md visible-sm visible-xs"> <?php echo get_the_date('H:s | d/m/Y'); ?></span>
                									</div>
                								</li>
                                                            
                                 <?php  }} wp_reset_postdata(); ?>
                            
									
							</ul>
						</div>
					</div><!--End block-row-->
					
					<div class="clear"> </div>
					<div class="block-row">
						<div class="block-head">
							<div class="line-2"></div>
							<h1 class="two-word"> THƯ GIÃN </h1>
							<div class="line-2"></div>
						</div>
						<div class="block-1-0">
							<div class="block-1-0-top-box">
								<div class="block-1-0-top-box-left">
									<div class="feature-landscape sm-fea-wid">
                                        <?php $postID_exclude = array();
                                                $args = array(
                                                    'category_name'      => 'thu-gian',
                                                	'posts_per_page'      => 1
                                                     
                                                    );
                                                $the_query = new WP_Query($args);
                                                // The Loop
                                                if ( $the_query->have_posts() ) {
                                                	
                                                	while ( $the_query->have_posts() ) {
                                                		$the_query->the_post();
                                                        array_push($postID_exclude,get_the_ID()); ?>
                                                        
                                                        <a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat;background-size: cover;" class="cover fa-height"> <img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?>" /> </a>
                										<a href="<?php esc_url(the_permalink())?>" style="display: inline;"><h2> <?php the_title() ?></h2></a>
                										<p class="summary hidden-sm hidden-xs"> <?php echo substr(get_the_excerpt(), 0,148); ?>..  </p>
                                                        
                                         <?php  }} wp_reset_postdata(); ?>
                                         
										<ul class="relate hidden-xs">
                                            <?php $args = array(
                                                        'category_name'      => 'thu-gian',
                                                    	'posts_per_page'      => 3,
                                                        'post__not_in'        =>$postID_exclude
                                                         
                                                        );
                                                    $the_query = new WP_Query($args);
                                                    // The Loop
                                                    if ( $the_query->have_posts() ) {
                                                    	
                                                    	while ( $the_query->have_posts() ) {
                                                    		$the_query->the_post();
                                                            array_push($postID_exclude,get_the_ID()); ?>
                                                            
                                                            <li><a href="<?php esc_url(the_permalink())?>"><?php the_title() ?></a></li>
                                                            
                                             <?php  }} wp_reset_postdata(); ?>
                                        
										</ul>
									</div>
								</div>
								<div class="block-1-0-top-box-right full-width-xs">
									<div class="feature-landscape">
                                        <?php $args = array(
                                                    'category_name'      => 'thu-gian',
                                                   	'posts_per_page'      => 1,
                                                    'post__not_in'        =>$postID_exclude
                                                         
                                                );
                                                $the_query = new WP_Query($args);
                                                // The Loop
                                                if ( $the_query->have_posts() ) {
                                                    	
                                               	    while ( $the_query->have_posts() ) {
                                                  		$the_query->the_post();
                                                        array_push($postID_exclude,get_the_ID()); ?>
                                                        <a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat;background-size: cover;" class="cover fa-feature2"> <img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?>"/> </a>
                                                        <a href="<?php esc_url(the_permalink())?>" style="display: inline;"><h2> <?php the_title() ?></h2></a>
                                            
                                                            
                                        <?php  }} wp_reset_postdata(); ?>
                                        
										<ul class="relate fa-relate2">
                                            <?php $args = array(
                                                        'category_name'      => 'thu-gian',
                                                       	'posts_per_page'      => 4,
                                                        'post__not_in'        =>$postID_exclude
                                                             
                                                    );
                                                    $the_query = new WP_Query($args);
                                                    // The Loop
                                                    if ( $the_query->have_posts() ) {
                                                        	
                                                   	    while ( $the_query->have_posts() ) {
                                                      		$the_query->the_post(); ?>
                                                            <li><a href="<?php esc_url(the_permalink())?>"><?php the_title() ?></a></li>
                                                                
                                            <?php  }} wp_reset_postdata(); ?>
											
										</ul>
									</div>
								</div>
							</div>
							
							
						</div>
					</div><!--End block-row-->
					<div class="clear"> </div>
				</div><!--End left-block-->
				<div class="right-block hidden-md hidden-sm hidden-xs" id="right-bar">
					<div class="block-row entertain">
						<h1> GIẢI TRÍ</h1>
						<ul class="items-list">
                            <?php $args = array(
                                      'category_name'      => 'giai-tri',
                           	          'posts_per_page'      => 6
                                   );
                                   $the_query = new WP_Query($args);
                                   // The Loop
                                   if ( $the_query->have_posts() ) {
                                       while ( $the_query->have_posts() ) {
                                            $the_query->the_post(); ?>
                                            <li>
                								<div class="news-item" > 
                									<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;" class="img_rblock">
                										<img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?>"/>
                									</a>
                									<a href="<?php esc_url(the_permalink())?>"> <?php the_title() ?> </a>
                								</div>
                							</li>
                							<div class="clear"> </div>
                                            
                                                                
                            <?php  }} wp_reset_postdata(); ?>
									
						</ul>
					</div><!--End block-row-->
					<div class="clear"> </div>
					<div class="block-row marry">
						<h1> YÊU & YÊU</h1>
						<ul class="items-list">
                            <?php $i = 0; $args = array(
                                      'category_name'      => 'yeu-yeu',
                           	          'posts_per_page'      => 6
                                   );
                                   $the_query = new WP_Query($args);
                                   // The Loop
                                   if ( $the_query->have_posts() ) {
                                       while ( $the_query->have_posts() ) {
                                            $the_query->the_post(); 
                                            if($i <= 0) {
                                            ?>
                                            <li>
                								<div class="news-item feature"> 
                									<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;" class="img">
                										<img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?>"/></a>
                									<a href="<?php esc_url(the_permalink())?>" class="tit"> <?php the_title() ?> </a>
                								</div>
                							</li>
                                            
                                            <?php } else {?>
                                             <li>
                								<div class="news-item"> 
                									<a href="<?php esc_url(the_permalink())?>"> <?php the_title() ?> </a>
                								</div>
                							</li>                   
                            <?php  }$i++; }} wp_reset_postdata(); ?>
                      
									
						</ul>
					</div><!--End block-row-->
					<div class="clear"> </div>
					<div class="block-row video">
						<h1> VIDEO</h1>
						<ul class="items-list">
                            <?php $i = 0;
                                    $args = array(
                                        'category_name'      =>'video',
                                        'post_type'         => 'video',
                                    	'posts_per_page'    => 6,
                                        'orderby'             =>  'meta_value_num',
                                        'order'               => 'DESC',
                                        );
                                    $the_query = new WP_Query($args);
                                    // The Loop
                                    if ( $the_query->have_posts() ) {
                                    	
                                    	while ( $the_query->have_posts() ) {
                                    		$the_query->the_post();
                                            array_push($postID_exclude,get_the_ID());
                                            ?>
                                            <li>
                								<div class="news-item "> 
                                                    <?php if($i <= 0){?>
                									<a href="<?php esc_url(the_permalink())?>" style="background:url(<?php echo get_bg_image(get_the_ID());?>) no-repeat; background-size: cover;" class="img">
                										<img src="<?php echo get_bg_image(get_the_ID());?>" alt="<?php the_title() ?>"/>
                									</a>
                                                    <a href="<?php esc_url(the_permalink())?>" class="video-cover"></a>
                                                    <?php } ?>
                									<a href="<?php esc_url(the_permalink())?>" class="tit"> <?php the_title() ?></a>
                								</div>
                							</li>
                                            
 						         <?php   $i++; }} wp_reset_postdata(); ?>
                        	
						</ul>
					</div><!--End block-row-->
					<div class="clear"> </div>
					<div class="block-row social">
						<h1> KẾT NỐI</h1>
						<div class="items-list">
							<iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fphunuchungminh&amp;width&amp;height=290&amp;colorscheme=light&amp;show_faces=true&amp;header=true&amp;stream=false&amp;show_border=true" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:290px;" allowTransparency="true"></iframe>
						</div>
					</div><!--End block-row-->
					<div class="clear"> </div>
					<div class="block-row" id="left-fixed-sidebar">
						<div class="items-list">
							<a href="#"><img src="<?php echo get_template_directory_uri() ?>/images/banner_300x250.png" alt="fadf"/></a>
						</div>
                        <div class="clear"> </div>
                        <div class="items-list">
							<a href="#"><img src="<?php echo get_template_directory_uri() ?>/images/banner_300x600.png" alt="fadf"/></a>
						</div>
					</div><!--End block-row-->
				</div><!--End right-block-->	
				
			</div><!--End container-->
		</div><!--End wrapper-->
		
</div><!--End content-->
<script>
    $(function(){ // document ready
 
      var stickyTop = $('#left-fixed-sidebar').offset().top;
      var limit = $('#scrolltop').offset().top ;
      //alert(limit);
      $(window).scroll(function(){ // scroll event  
        var windowTop = $(window).scrollTop(); // returns number
        var lenth = $('#left-fixed-sidebar').height() + windowTop ;
        if( lenth > limit ){
            $('#left-fixed-sidebar').css({ position: 'fixed', bottom: 200, top: 'auto'});
        }
        else if (stickyTop < windowTop) {
          $('#left-fixed-sidebar').css({ position: 'fixed', top: 29 });
        }
        else {
          $('#left-fixed-sidebar').css('position','relative');
        }
        
     
      });
 
});
</script>
<?php get_footer(); ?>